package com.yymmarket.forum.bbs;

import java.util.Comparator;

public class LastReplyTimeComparator implements Comparator<Integer> {

	public int compare(Integer o1, Integer o2) {
		
		ContentService contentService = ContentService.getInstance();
		ContentBean bean1 = contentService.getContentById(o1);
		ContentBean bean2 = contentService.getContentById(o2);
		
		if(bean1!=null&&bean2!=null) {
			if(bean1.getLastReplyTime().getTime()<bean2.getLastReplyTime().getTime()) {
				return -1;
			}
			
			if(bean1.getLastReplyTime().getTime()>bean2.getLastReplyTime().getTime()) {
				return 1;
			}
		} else if(bean1==null&&bean2!=null) {
			return -1;
		} else if(bean1!=null&&bean2==null) {
			return 1;
		}
		return 0;
	}

}
